<!DOCTYPE html>
<html style="height: 100%;">

<head>
    <meta charset="utf-8">
    <title>原生交互测试用例</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
</head>

<body>
<input type="file" onchange='handleInputChange'>
<p id="testGoBack" onclick="testGoBack()">测试返回</p>
<p id="upload" onclick="upload()">11.上传</p>
<p id="imageWriteToSavedPhotosAlbum" onclick="imageWriteToSavedPhotosAlbum()">保存图片</p>
<p id="openbtn" onclick="openbtn()">选择人员多选</p>
<p id="openbtnsingle" onclick="openbtnsingle()">选择人员单选</p>
<p id="soundRecording" onclick="soundRecording()">soundRecording</p>
<p id="captureAudio" onclick="captureAudio()">10、录音机 - captureAudio</p>
<p id="call" style="color: #4cd964" onclick="call()">1、拨打电话 - call</p>
<p id="sms" onclick="sms()">2、发送短信 - sms</p>
<p id="email" onclick="email()">3、发送邮件 - email</p>
<p id="openAttach" onclick="openAttach()">4、打开附件 - openAttach</p>
<p id="openWebview1" onclick="openWebview1()">5、打开新的网页 - openWebview</p>
<p id="openWebview2" onclick="openWebview2()">5、打开新的网页 - openWebview</p>
<p id="openWebview3" onclick="openWebview3()">5、打开新的网页 - openWebview</p>
<p id="share0" onclick="share0()">6、分享 - share</p>
<p id="share1" onclick="share1()">6、分享 - share</p>
<p id="share2" onclick="share2()">6、分享 - share</p>
<p id="share3" onclick="share3()">6、分享 - share</p>
<p id="closewindow" onclick="closewindow()">7、关闭窗口 - closewindow</p>
<p id="scan1" onclick="scan1()">8、扫描二维码 -scan(openWebview)</p>
<p id="scan2" onclick="scan2()">8、扫描二维码 -scan(noDail)</p>
<p id="closeFlushwindow" onclick="closeFlushwindow()">9、关闭并刷新桌面小部件–closeFlushwindow</p>
<p id="a" onclick="a()">变色</p>
<p id="openCompany" onclick="openCompany()">选组织</p>
<p id="getCompany" onclick="getCompany()">获取组织</p>
<p id="testmsgnode" onclick="testmsgnode()">消息节点@插件调用方法</p>
<!-- 引入服务器端JS资源-->
<script src="yyjzh5plus.js"></script>
<script src="util/util.js"></script>
<!-- 调用方法-->
<script>
    function testGoBack() {
        alert('测试返回')
    }

    function openCompany() {
        var checkCompanys = [{
            id: 'test',
        }]
        YYPlugin.call("CommonPlugin", "openWebview", {
            url: 'http://10.10.3.114:9081/maservlet/html/addressnew/index.html?code=wang1#/checkOrg/checkOrg',
            appid: 'ssss',
            nav: '1'
        });
        //YYPlugin.call("ExpandPlugin","getCurCompany");
        //YYPlugin.call("ExpandPlugin","saveCompany",{"companys":checkCompanys});
    }

    function getCompany() {
        YYPlugin.call("ExpandPlugin", "getCompany", null, function (data) {
            alert(data.id)
        });

    }

    function testmsgnode() {
        var urlParams = ICOPMobile.GetAllRequest();
        console.log(urlParams);
        var params = {};
        params.users = [
            {
                "code": "li.haibin",
                "nick": "测试"
            },
            {
                "code": "xubing"
            }
        ];
        params.appid = "cscec";
        params.groupId = urlParams.groupId;
        params.currentChat = urlParams.currentChat;
        params.content = "你有一条消息提醒";
        params.url = "https://www.yonyouccs.com/icop-website/";
        YYPlugin.call("ExpandPlugin", "callFromGroup", params, function (data) {
            alert('成功' + data)
        }, function (error) {
            alert('失败' + error)
        });

    }

    function openbtn() {
        YYPlugin.call("ExpandPlugin", "openContact", {single: false}, function (data) {
            console.log(data)
            alert(JSON.stringify(data))
        });
    }

    function openbtnsingle() {
        YYPlugin.call("ExpandPlugin", "openContact", {single: true}, function (data) {
            console.log(data)
            alert(JSON.stringify(data))
        });
    }

    function soundRecording() {
        YYPlugin.call("ExpandPlugin", "soundRecording", null, function (data) {
            alert(JSON.stringify(data))
        });
    }

    function captureAudio() {
        //开始采集音频
        navigator.device.capture.captureAudio(
            function (mediaFiles) {
                var path;
                for (var i = 0; i < mediaFiles.length; i += 1) {
                    path = mediaFiles[i].fullPath;
                    //对文件进行感兴趣的操作
                }
            },
            function (error) {
                alert('Error code: ' + error.code, null, 'Capture Error');
            },
            {limit: 2});
    }

    function a() {
        console.log(1)
        document.getElementById('call').style.color = 'red'
        console.log(1)
        /*YYPlugin.call("ExpandPlugin","changeColor");*/
    }

    function call() {
        YYPlugin.call("CommonPlugin", "call", {phone: 10000});
    }

    function sms() {
        YYPlugin.call("CommonPlugin", "sms", {phone: '18511286697', message: '徐成'});
    }

    function email() {
        YYPlugin.call("CommonPlugin", "email", {receive: 'wanghh1@yonyou.com'});
    }

    function openAttach() {
        YYPlugin.call("CommonPlugin", "openAttach", {url: 'http://og1wpi0ei.bkt.clouddn.com/c.txt'});
    }

    function openWebview1() {
        YYPlugin.call("CommonPlugin", "openWebview", {
            url: 'http://10.10.3.114:9081/maservlet/html/address/test2.html',
            appid: 'ssss',
            nav: '0'
        });
    }

    function openWebview2() {
        YYPlugin.call("CommonPlugin", "openWebview", {url: 'http://www.baidu.com', appid: 'ssss', nav: '1'});
    }

    function openWebview3() {
        YYPlugin.call("CommonPlugin", "openWebview", {
            url: 'http://10.10.3.114:9081/maservlet/html/address/test2.html',
            appid: 'ssss'
        });
    }

    function share0() {
        YYPlugin.call("CommonPlugin", "share", {type: 0, text: '测试cordova'});
    }

    function share1() {
        YYPlugin.call("CommonPlugin", "share", {type: 1, url: 'http://og1wpi0ei.bkt.clouddn.com/1-57.png'});
    }

    function share2() {
        YYPlugin.call("CommonPlugin", "share", {
            type: 2,
            text: 'less',
            url: 'http://og1wpi0ei.bkt.clouddn.com/1-57.png'
        });
    }

    function share3() {
        YYPlugin.call("CommonPlugin", "share", {
            type: 3,
            title: 'ssss',
            descr: 'sssssssss',
            url: 'http://10.10.3.114:9081/maservlet/html/address/test2.html'
        });
    }

    function closewindow() {
        YYPlugin.call("CommonPlugin", "closewindow");
    }

    function scan1() {
        YYPlugin.call("CommonPlugin", "scan", {command: "openWebview"}, function (info) {
        });
    }

    function scan2() {
        YYPlugin.call("CommonPlugin", "scan", {command: "noDail"}, function (info) {
            alert(info.result)
        });
    }

    function closeFlushwindow() {
        YYPlugin.call("ExpandPlugin", "closeFlushwindow");
    }

</script>
</body>

</html>